//
//  SleepListVC.m
//  Ginix
//
//  Created by fzq on 2025/3/3.
//

#import "SleepListVC.h"
#import "SleepNatureView.h"
#import "SleepMediView.h"
#import "SleepRelaxView.h"
#import "SleepLightView.h"

@interface SleepListVC ()
@property (nonatomic, strong) JXCategoryTitleView   * myCategoryView;
@property (nonatomic,strong) UIScrollView * contentView;
@property (nonatomic,strong) NSMutableArray * listArray;

@property (nonatomic,strong) SleepNatureView * natureView;
@property (nonatomic,strong) SleepMediView * mediView;
@property (nonatomic,strong) SleepRelaxView * relaxView;
@property (nonatomic,strong) SleepLightView * lightView;

@end

@implementation SleepListVC

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setSubViewLayout];
}

-(void)setSubViewLayout{
    
    self.bgView.hidden = YES;
    self.navgationView.iconView.image = [UIImage imageNamed:@"Home_titlte_icon_write"];
    self.navgationView.backgroundColor = UIColor.clearColor;
    self.view.backgroundColor = RDRGB(0x776856);
    [self.view addSubview:self.myCategoryView];
    [self.view addSubview:self.contentView];
    
    [self.contentView addSubview:self.natureView];
    [self.contentView addSubview:self.mediView];
    [self.contentView addSubview:self.relaxView];
    [self.contentView addSubview:self.lightView];

    switch (self.typeId) {
        case 111:
            [self.myCategoryView setDefaultSelectedIndex:0];
            break;
        case 222:
            [self.myCategoryView setDefaultSelectedIndex:1];
            break;
        case 333:
            [self.myCategoryView setDefaultSelectedIndex:2];
            break;
        case 444:
            [self.myCategoryView setDefaultSelectedIndex:3];
            break;
        default:
            break;
    }
    
}

-(JXCategoryTitleView *)myCategoryView{
    
    if (!_myCategoryView) {
        _myCategoryView = [[JXCategoryTitleView alloc]initWithFrame:CGRectMake(5, NavHeight + 10 * FMScaleX, WIDTH, 40)];
        _myCategoryView.titles = @[@"自然声",@"冥想正念",@"助眠放松",@"轻音乐"];
        _myCategoryView.titleColor = RDRGBA(0xffffff, 0.8);
        _myCategoryView.titleSelectedColor = RDRGB(0xffffff);
        _myCategoryView.titleLabelZoomScale = 1.2;
        _myCategoryView.titleLabelZoomEnabled = YES;
        _myCategoryView.contentScrollView = self.contentView;
        _myCategoryView.titleSelectedFont = Semibold(14);
        _myCategoryView.titleFont = Regular(14);
        
        JXCategoryIndicatorLineView *lineView = [[JXCategoryIndicatorLineView alloc] init];
        lineView.indicatorColor = RDRGB(0xffffff);
        lineView.indicatorWidth = 20 * FMScaleX;
        lineView.indicatorHeight = 3;
        _myCategoryView.indicators = @[lineView];
    }
    return _myCategoryView;
}
-(UIScrollView *)contentView{
    
    if (!_contentView) {
        _contentView = [[UIScrollView alloc]initWithFrame:CGRectMake(0, GETMaxY(self.myCategoryView) +1, WIDTH, HEIGHT - NavHeight - 85 * FMScaleX - safaHeight - TabBarHeight )];
        _contentView.contentSize = CGSizeMake(WIDTH * 4, _contentView.getHeight);
        _contentView.backgroundColor = UIColor.clearColor;
        _contentView.showsVerticalScrollIndicator = NO;
        _contentView.showsHorizontalScrollIndicator = NO;
        _contentView.bounces = NO;
        _contentView.pagingEnabled = YES;
    }
    return _contentView;
}
-(NSMutableArray *)listArray{
    
    if(!_listArray){
        _listArray = [[NSMutableArray alloc]init];
    }
    return _listArray;
}

-(SleepNatureView *)natureView{
    
    if(!_natureView){
        _natureView = [[SleepNatureView alloc]initWithFrame:CGRectMake(0, 0, _contentView.getWidth, _contentView.getHeight)];
    }
    return _natureView;
}
-(SleepMediView *)mediView{
    
    if(!_mediView){
        _mediView = [[SleepMediView alloc]initWithFrame:CGRectMake(WIDTH, 0, _contentView.getWidth, _contentView.getHeight)];
    }
    return _mediView;
    
}
-(SleepRelaxView *)relaxView{
    
    if(!_relaxView){
        _relaxView = [[SleepRelaxView alloc]initWithFrame:CGRectMake(WIDTH * 2, 0, _contentView.getWidth, _contentView.getHeight)];
    }
    return _relaxView;
}
-(SleepLightView *)lightView{
    
    if(!_lightView){
        _lightView = [[SleepLightView alloc]initWithFrame:CGRectMake(WIDTH * 3, 0, _contentView.getWidth, _contentView.getHeight)];
    }
    return _lightView;
}
@end
